package com.bobo.controller;

import com.bobo.pojo.ResposeResult;
import com.bobo.pojo.User;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;


@RestControllerAdvice
public class ControllerAdviceAspect {

    @ExceptionHandler(Exception.class)
    public Object handlerExeception(HttpServletRequest request,Exception e){
        ResposeResult<User> result = new ResposeResult<User>();
        result.setCode(600);
        result.setMsg(e.getMessage());
        result.setData(null);
        return result;

    }
}
